package instantHelper.Models;

import java.io.IOException;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpParams;

public class ConnectingRequests {
	private String url;
	private List<NameValuePair> nameValuePairs;

	public ConnectingRequests(String url, List<NameValuePair> nameValuePairs) {
		this.url = url;
		this.nameValuePairs = nameValuePairs;
	}

	public void postData() {
		// Create a new HttpClient and Post Header
		HttpClient httpclient = new DefaultHttpClient();
		// HttpPost httppost = new
		// HttpPost("http://192.168.2.26:8080/ihcenterapp/androidhelprequest/newHelpRequest");
		HttpPost httppost = new HttpPost(url);

		try {

			httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

			// Execute HTTP Post Request
			HttpResponse response = httpclient.execute(httppost);
			HttpParams params = response.getParams();
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
		} catch (IOException e) {
			e.printStackTrace();
			// TODO Auto-generated catch block
		}
	}

}
